Release 10.1A: OpenEdge Development:
Progress 4GL Reference


WEEKDAY function

Evaluates a date expression and returns the day of the week as an integer from 1 (Sunday) to 7 (Saturday) for that date.

Syntax

WEEKDAY ( date ) 

WEEKDAY ( datetime-expression ) 

date

A date expression for which you want the day of the week.

datetime-expression

An expression that evaluates to a DATETIME or DATETIME-TZ. The WEEKDAY function returns the weekday of the date part of the DATETIME or DATETIME-TZ value.

Example

This procedure tells you the day of the week that you were born and how many days old you are:

r-wkday.p
DEFINE VARIABLE birth-date AS DATE
  LABEL "Birth Date".
DEFINE VARIABLE daynum AS INTEGER.
DEFINE VARIABLE daylist AS CHARACTER FORMAT "x(9)"
  INITIAL "Sunday, Monday, Tuesday, Wednesday, Thursday, 
      Friday, Saturday".
DEFINE VARIABLE dayname AS CHARACTER
  LABEL "Day You Were Born".
DEFINE VARIABLE daysold AS INTEGER
  LABEL "Days Since You Were Born". 
REPEAT:
  SET birth-date.
  daynum = WEEKDAY(birth-date).
  dayname = ENTRY(daynum,daylist).
  daysold = TODAY - birth-date.
  DISPLAY dayname daysold.
END. 

See also

DAY function, MONTH function, NOW function, TODAY function


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095